package com.sys.framework.base.intercepter;

import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;

import com.codingapi.tx.dubbo.interceptor.TxManagerInterceptor;

/**
 * Created by lorne on 2017/6/28.
 */
// @Aspect
// @Component
public class TxTransactionInterceptor implements Ordered {
    private static final Logger logger = LoggerFactory.getLogger(TxTransactionInterceptor.class);

    @Override
    public int getOrder() {
        return 1;
    }

    @Autowired
    private TxManagerInterceptor txManagerInterceptor;

    // @Around("execution(* com.chinazyjr.openlab..*.*(..))")
    // public Object around(ProceedingJoinPoint point) throws Throwable {
    // System.out.println("--------------zyManagerInterceptor--------------");
    // return txManagerInterceptor.around(point);
    // }

    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {

        logger.info("**** begin invoke TxTransactionInterceptor by chinazyjr.  ");
        return txManagerInterceptor.around(pjp);
    }
}
